/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.bluelogic.managebean;

import br.com.bluelogic.bean.Email;
import br.com.bluelogic.dao.eMailDAO;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Administrador
 */
@ManagedBean
@RequestScoped
public class enviaEmail {

    Email eMail = new Email();
    eMailDAO dao = new eMailDAO();

    public enviaEmail(){

    }

    public Email geteMail() {
        return eMail;
    }

    public void seteMail(Email eMail) {
        this.eMail = eMail;
    }

    public String enviarEmail(){          
        if (dao.enviaEmail(eMail) == true) {
            limpar();
            return "sucesso";
        }else
            return "erro";       
    }

    public void limpar(){
        eMail.setMensagem("");
        eMail.setNome("");
        eMail.seteMail("");
    }

}
